package com.ccys.doctor.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.ccys.common.vo.ResponseResultApp;
import com.ccys.db.mapper.TblBookingMemoMapper;
import com.ccys.db.vo.doctor.memo.GetMemoAttachedFilesVo;
import com.ccys.doctor.service.MemoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: WhiteCoat
 * @description:
 * @author: ZhangJingCan
 * @create: 2024-02-21 10:20
 **/

@Service
public class MemoServiceImpl implements MemoService {

    @Resource
    private TblBookingMemoMapper tblBookingMemoMapper;

    @Override
    public ResponseResultApp<List<GetMemoAttachedFilesVo>> getMemoAttachedFiles(String bookingId) {
        if (ObjectUtil.isEmpty(bookingId)){
            return ResponseResultApp.error("Parameter abnormality");
        }
        /**
         * todo 对方返回的数据  - 这里需要等待辉哥做s3的加密解密，得到临时的秘钥信息等等然后拼接
         * "file_name": "WC_13185891727595_1.jpg",
         *             "file_byte": null,
         *             "file_path": "Consultation/Memo/WC_13185891727595_1.jpg",
         *             "link_s3": "https://s3-ap-southeast-1.amazonaws.com/prv.staging.whitecoat.global/Consultation/Memo/WC_13185891727595_1.jpg?AWSAccessKeyId=AKIAIHBBQGPKQR7KO5BQ&Expires=1709087426&Signature=ZlyA8grZV8y9lLrAkWSB78Ls0Dk%3D"
         */
        //这里只是查询fileName
        List<GetMemoAttachedFilesVo> list = tblBookingMemoMapper.getMemoAttachedFiles(bookingId);
        //如果不为空才去拼接地址 - 如果为空格 - 直接返回即可
        if (ObjectUtil.isNotEmpty(list)){
            StringBuffer path = new StringBuffer();
            StringBuffer linkS3 = new StringBuffer();
            //todo 拼接路径即可
            path.append("");
        }
        return ResponseResultApp.success(list);
    }
}
